<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>专利协同服务平台</title>
<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
<meta http-equiv="description" content="this is my page">
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name="viewport"
	content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<link href="${pageContext.request.contextPath}/css/style.css"
	rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css"
	href="${pageContext.request.contextPath}/css/H-ui.css" />
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/jquery/jquery.min.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/layer.js"></script>
<script type="text/javascript"
	src="${pageContext.request.contextPath}/js/H-ui.js"></script>

<script type="text/javascript">
	//富文本编译器
	var MyUE = null;
	//多文件上传
	$(function() {
		$("#addFile")
				.click(
						function() {
							var i = $(".fileindex").length + 1;
							$(this)
									.parent()
									.parent()
									.before(
											"<div class='row cl fileindex' style='margin-left:7.3%;'>"
													+ "<label class='form-label col-xs-3'>附件"
													+ i
													+ "：</label>"
													+ "<div class='formControls col-xs-8'>"
													+ "<span class='btn-upload form-group'>"
													+ "<input class='input-text upload-url' type='text' name='uploadfile-2' id='uploadfile-2' readonly style='width:200px'>"
													+ "<a href='javascript:void();' class='btn btn-primary upload-btn' style='margin-left:3px'>"
													+ "<i class='Hui-iconfont'>&#xe642;</i> 浏览文件</a>"
													+ "<input type='file'  id='uploadfiles' name='finishReportFile' class='input-file' style='width:100px;'>"
													+ "</span>"
													+ "<input type='button' style='margin-left:30px;' id='delete"
													+ i
													+ "'class='btn btn-primary'  onclick='deleteDiv("
													+ i + ")' value='删除'/>"
													+ "</div>" + "</div>");
						});
	});//end jquery 
	//删除附件节点
	function deleteDiv(i) {
		var $div = $("#delete" + i).parent().parent();
		$div.remove(); //删除当前元素
		//对file重写排序
		$(".fileindex").each(
				function(index) { //遍历所有的file
					var n = index + 1;
					$(this).find(":first").text("附件" + n);
					$(this).find("div:first span").find("input[type='file']")
							.attr("name", "file" + n);
				});
	}//end method
</script>
</head>
<body>
	<div class="place">
		<span>位置：</span>
		<ul class="placeul">
			<li><a href="#">首页</a></li>
			<li><a href="#">已接单专利</a></li>
			<li><a href="#">提交结项报告</a></li>
		</ul>
	</div>
	<div class="formbody">
		<div class="formtitle">
			<span>结项报告</span>
		</div>
		<form id="finishPatent"
			action="${pageContext.request.contextPath}/scienceExpert/finishPatent.do"
			method="post" enctype="multipart/form-data">
			<input type="hidden" name="patentId" value="${patentId}" />
			<ul class="forminfo">
				<li><label>结项意见</label> <textarea id="finishSummary" name="finishSummary" cols=""
						rows="" class="textinput"  required></textarea></li>
				<li>
					<div class="row cl">
						<label class="form-label col-xs-3">结项报告</label>	<br>
						<div class="row cl fileindex">
									<label class="form-label col-xs-3">附件1：</label>
									<div class="formControls col-xs-8">
										<span class="btn-upload form-group"> <input
											class="input-text upload-url" type="text" name="uploadfile-2"
											id="uploadfile-2" readonly style="width: 200px"> <a
											href="javascript:void();" class="btn btn-primary upload-btn"><i
												class="Hui-iconfont">&#xe642;</i> 浏览文件</a> <input type="file"
											id="uploadfiles" name="finishReportFile" class="input-file">
										</span>
									</div>
						</div>
								<div class="row cl">
									<div class="col-xs-8 col-xs-offset-3"
										style="width: 100px; float: left;margin-left: 32.6%;">
										<input id="addFile" class="btn btn-primary" type="button"
											value="新增附件" style="margin-top: 38%;">
									</div>
									<div class="row cl">
									<div class="col-xs-8 col-xs-offset-3"
										style="width: 100px; float: left;margin-left: 32.6%;">
										<input type="radio" name="sendMsg" value="true" />发送结项短信给科研人员<br>
										<input type="radio" value="sendMsg" />不发送结项短信给科研人员
									
									</div>
									<div class="col-xs-8 col-xs-offset-3"
										style="width: 100px; float: left; margin-left: 10px;">
										<input id="button" class="btn btn-primary" type="button"
											onclick="finishPatent()"
											value="&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;提交并结项&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" style="margin-top: 38%;" />
									</div>
								</div>
					<!--  <div class="formControls col-xs-8">
							<span class="btn-upload form-group"> <input
								class="input-text upload-url" type="text" name="uploadfile-1"
								id="uploadfile-1" readonly style="width: 200px"> <a
								href="javascript:void();" class="btn btn-primary upload-btn">浏览文件</a>
								<input type="file" multiple name="finishReportFile"
								class="input-file">
							</span>
						</div>-->
					</div>
				</li>
			</ul>
		</form>
	</div>


	<script type="text/javascript">
		function finishPatent() {
		var flag = $("#finishSummary").val();	
		//var flag = document.getElementById("finishSummary").value;
		if(flag!=null&&flag!=""){
			layer.msg("结项报告提交成功");
			setTimeout(function(){
				$("#finishPatent").submit();
				var index = parent.layer.getFrameIndex(window.name); //获取窗口索引
				parent.layer.close(index); // 关闭layer
				console.log(window.parent.location);
				window.parent.parent.location.reload();
				},1000);
			}else{
				$('textarea').attr('placeholder',"请添加结项意见。。。");
			}
		}
	</script>
</body>
</html>